home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / gdb / doc / gdbinv-s.m4.in < prev    next >
Encoding:
Text File  |  1992-03-04  |  18.9 KB  |  540 lines

  1. _dnl__                                -*- Texinfo -*-
  2. _dnl__ Copyright (c) 1990 1991 1992 Free Software Foundation, Inc.
  3. _dnl__ This file is part of the source for the GDB manual.
  4. _dnl__ M4 FRAGMENT $Id: gdbinv-s.m4.in,v 2.4 1992/03/04 01:08:43 pesch Exp $
  5. _dnl__ This text diverted to "Remote Debugging" section in general case;
  6. _dnl__ however, if we're doing a manual specifically for one of these, it
  7. _dnl__ belongs up front (in "Getting In and Out" chapter).
  8. _if__(_I960__)
  9. _if__(!_GENERIC__)
  10. @node i960-Nindy Remote, EB29K Remote, Mode Options, Starting _GDBN__
  11. _fi__(!_GENERIC__)
  12. _if__(_GENERIC__)
  13. @node i960-Nindy Remote, EB29K Remote, Remote, Remote
  14. _fi__(_GENERIC__)
  15. @subsection _GDBN__ with a Remote i960 (Nindy)
  16.  
  17. @cindex Nindy
  18. @cindex i960
  19. @dfn{Nindy} is a ROM Monitor program for Intel 960 target systems.  When
  20. _GDBN__ is configured to control a remote Intel 960 using Nindy, you can
  21. tell _GDBN__ how to connect to the 960 in several ways:
  22.  
  23. @itemize @bullet
  24. @item
  25. Through command line options specifying serial port, version of the
  26. Nindy protocol, and communications speed;
  27.  
  28. @item
  29. By responding to a prompt on startup;
  30.  
  31. @item
  32. By using the @code{target} command at any point during your _GDBN__
  33. session.  @xref{Target Commands, ,Commands for Managing Targets}.
  34.  
  35. @end itemize
  36.  
  37. @menu
  38. * Nindy Startup::               Startup with Nindy
  39. * Nindy Options::               Options for Nindy
  40. * Nindy reset::                 Nindy Reset Command
  41. @end menu
  42.  
  43. @node Nindy Startup, Nindy Options, i960-Nindy Remote, i960-Nindy Remote
  44. @subsubsection Startup with Nindy
  45.  
  46. If you simply start @code{_GDBP__} without using any command-line
  47. options, you are prompted for what serial port to use, @emph{before} you
  48. reach the ordinary _GDBN__ prompt:
  49.  
  50. @example
  51. Attach /dev/ttyNN -- specify NN, or "quit" to quit:  
  52. @end example
  53.  
  54. @noindent
  55. Respond to the prompt with whatever suffix (after @samp{/dev/tty})
  56. identifies the serial port you want to use.  You can, if you choose,
  57. simply start up with no Nindy connection by responding to the prompt
  58. with an empty line.  If you do this, and later wish to attach to Nindy,
  59. use @code{target} (@pxref{Target Commands, ,Commands for Managing Targets}).
  60.  
  61. @node Nindy Options, Nindy reset, Nindy Startup, i960-Nindy Remote
  62. @subsubsection Options for Nindy
  63.  
  64. These are the startup options for beginning your _GDBN__ session with a
  65. Nindy-960 board attached:
  66.  
  67. @table @code
  68. @item -r @var{port}
  69. Specify the serial port name of a serial interface to be used to connect
  70. to the target system.  This option is only available when _GDBN__ is
  71. configured for the Intel 960 target architecture.  You may specify
  72. @var{port} as any of: a full pathname (e.g. @samp{-r /dev/ttya}), a
  73. device name in @file{/dev} (e.g. @samp{-r ttya}), or simply the unique
  74. suffix for a specific @code{tty} (e.g. @samp{-r a}).
  75.  
  76. @item -O
  77. (An uppercase letter ``O'', not a zero.)  Specify that _GDBN__ should use
  78. the ``old'' Nindy monitor protocol to connect to the target system.
  79. This option is only available when _GDBN__ is configured for the Intel 960
  80. target architecture.
  81.  
  82. @quotation
  83. @emph{Warning:} if you specify @samp{-O}, but are actually trying to
  84. connect to a target system that expects the newer protocol, the connection
  85. will fail, appearing to be a speed mismatch.  _GDBN__ will repeatedly
  86. attempt to reconnect at several different line speeds.  You can abort
  87. this process with an interrupt.
  88. @end quotation
  89.  
  90. @item -brk
  91. Specify that _GDBN__ should first send a @code{BREAK} signal to the target
  92. system, in an attempt to reset it, before connecting to a Nindy target.
  93.  
  94. @quotation
  95. @emph{Warning:} Many target systems do not have the hardware that this
  96. requires; it only works with a few boards.
  97. @end quotation
  98. @end table
  99.  
  100. The standard @samp{-b} option controls the line speed used on the serial
  101. port.
  102.  
  103. @c @group
  104. @node Nindy reset,  , Nindy Options, i960-Nindy Remote
  105. @subsubsection Nindy Reset Command
  106.  
  107. @table @code
  108. @item reset
  109. @kindex reset
  110. For a Nindy target, this command sends a ``break'' to the remote target
  111. system; this is only useful if the target has been equipped with a
  112. circuit to perform a hard reset (or some other interesting action) when
  113. a break is detected.
  114. @end table
  115. @c @end group
  116. _fi__(_I960__)
  117.  
  118. _if__(_AMD29K__)
  119. _if__(!_GENERIC__)
  120. @node EB29K Remote, VxWorks Remote, i960-Nindy Remote, Starting _GDBN__
  121. _fi__(!_GENERIC__)
  122. _if__(_GENERIC__)
  123. @node EB29K Remote, VxWorks Remote, i960-Nindy Remote, Remote
  124. _fi__(_GENERIC__)
  125. @subsection _GDBN__ with a Remote EB29K
  126.  
  127. @cindex EB29K board
  128. @cindex running 29K programs
  129.  
  130. To use _GDBN__ from a Unix system to run programs on AMD's EB29K
  131. board in a PC, you must first connect a serial cable between the PC
  132. and a serial port on the Unix system.  In the following, we assume
  133. you've hooked the cable between the PC's @file{COM1} port and
  134. @file{/dev/ttya} on the Unix system.
  135.  
  136. @menu
  137. * Comms (EB29K)::               Communications Setup
  138. * _GDBP__-EB29K::                   EB29K cross-debugging
  139. * Remote Log::                  Remote Log
  140. @end menu
  141.  
  142. @node Comms (EB29K), _GDBP__-EB29K, EB29K Remote, EB29K Remote
  143. @subsubsection Communications Setup
  144.  
  145. The next step is to set up the PC's port, by doing something like the
  146. following in DOS on the PC:
  147.  
  148. _0__@example
  149. C:\> MODE com1:9600,n,8,1,none
  150. _1__@end example
  151.  
  152. @noindent
  153. This example---run on an MS DOS 4.0 system---sets the PC port to 9600
  154. bps, no parity, eight data bits, one stop bit, and no ``retry'' action;
  155. you must match the communications parameters when establishing the Unix
  156. end of the connection as well.
  157. @c FIXME: Who knows what this "no retry action" crud from the DOS manual may
  158. @c       mean?  It's optional; leave it out? ---pesch@cygnus.com, 25feb91 
  159.  
  160. To give control of the PC to the Unix side of the serial line, type
  161. the following at the DOS console:
  162.  
  163. _0__@example
  164. C:\> CTTY com1
  165. _1__@end example
  166.  
  167. @noindent
  168. (Later, if you wish to return control to the DOS console, you can use
  169. the command @code{CTTY con}---but you must send it over the device that
  170. had control, in our example over the @file{COM1} serial line).
  171.  
  172. From the Unix host, use a communications program such as @code{tip} or
  173. @code{cu} to communicate with the PC; for example,
  174.  
  175. @example
  176. cu -s 9600 -l /dev/ttya
  177. @end example
  178.  
  179. @noindent
  180. The @code{cu} options shown specify, respectively, the linespeed and the
  181. serial port to use.  If you use @code{tip} instead, your command line
  182. may look something like the following:
  183.  
  184. @example
  185. tip -9600 /dev/ttya
  186. @end example
  187.  
  188. @noindent
  189. Your system may define a different name where our example uses
  190. @file{/dev/ttya} as the argument to @code{tip}.  The communications
  191. parameters, including which port to use, are associated with the
  192. @code{tip} argument in the ``remote'' descriptions file---normally the
  193. system table @file{/etc/remote}.
  194. @c FIXME: What if anything needs doing to match the "n,8,1,none" part of
  195. @c the DOS side's comms setup?  cu can support -o (odd
  196. @c parity), -e (even parity)---apparently no settings for no parity or
  197. @c for character size.  Taken from stty maybe...?  John points out tip
  198. @c can set these as internal variables, eg ~s parity=none; man stty
  199. @c suggests that it *might* work to stty these options with stdin or
  200. @c stdout redirected... ---pesch@cygnus.com, 25feb91
  201.  
  202. @kindex EBMON
  203. Using the @code{tip} or @code{cu} connection, change the DOS working
  204. directory to the directory containing a copy of your 29K program, then
  205. start the PC program @code{EBMON} (an EB29K control program supplied
  206. with your board by AMD).  You should see an initial display from
  207. @code{EBMON} similar to the one that follows, ending with the
  208. @code{EBMON} prompt @samp{#}---
  209.  
  210. _0__@example
  211. C:\> G:
  212.  
  213. G:\> CD \usr\joe\work29k
  214.  
  215. G:\USR\JOE\WORK29K> EBMON
  216. Am29000 PC Coprocessor Board Monitor, version 3.0-18
  217. Copyright 1990 Advanced Micro Devices, Inc.
  218. Written by Gibbons and Associates, Inc.
  219.  
  220. Enter '?' or 'H' for help
  221.  
  222. PC Coprocessor Type   = EB29K
  223. I/O Base              = 0x208
  224. Memory Base           = 0xd0000
  225.  
  226. Data Memory Size      = 2048KB
  227. Available I-RAM Range = 0x8000 to 0x1fffff
  228. Available D-RAM Range = 0x80002000 to 0x801fffff
  229.  
  230. PageSize              = 0x400
  231. Register Stack Size   = 0x800
  232. Memory Stack Size     = 0x1800
  233.  
  234. CPU PRL               = 0x3
  235. Am29027 Available     = No
  236. Byte Write Available  = Yes
  237.  
  238. # ~.
  239. _1__@end example
  240.  
  241. Then exit the @code{cu} or @code{tip} program (done in the example by
  242. typing @code{~.} at the @code{EBMON} prompt).  @code{EBMON} will keep
  243. running, ready for _GDBN__ to take over.
  244.  
  245. For this example, we've assumed what is probably the most convenient
  246. way to make sure the same 29K program is on both the PC and the Unix
  247. system: a PC/NFS connection that establishes ``drive @code{G:}'' on the
  248. PC as a file system on the Unix host.  If you do not have PC/NFS or
  249. something similar connecting the two systems, you must arrange some
  250. other way---perhaps floppy-disk transfer---of getting the 29K program
  251. from the Unix system to the PC; _GDBN__ will @emph{not} download it over the
  252. serial line.
  253.  
  254. @node _GDBP__-EB29K, Remote Log, Comms (EB29K), EB29K Remote
  255. @subsubsection EB29K cross-debugging
  256.  
  257. Finally, @code{cd} to the directory containing an image of your 29K
  258. program on the Unix system, and start _GDBN__---specifying as argument the
  259. name of your 29K program:
  260.  
  261. @example
  262. cd /usr/joe/work29k
  263. _GDBP__ myfoo
  264. @end example
  265.  
  266. Now you can use the @code{target} command:
  267.  
  268. @example
  269. target amd-eb /dev/ttya 9600 MYFOO
  270. @c FIXME: test above 'target amd-eb' as spelled, with caps!  caps are meant to
  271. @c emphasize that this is the name as seen by DOS (since I think DOS is
  272. @c single-minded about case of letters).  ---pesch@cygnus.com, 25feb91
  273. @end example
  274.  
  275. @noindent
  276. In this example, we've assumed your program is in a file called
  277. @file{myfoo}.  Note that the filename given as the last argument to
  278. @code{target amd-eb} should be the name of the program as it appears to DOS.
  279. In our example this is simply @code{MYFOO}, but in general it can include
  280. a DOS path, and depending on your transfer mechanism may not resemble
  281. the name on the Unix side.
  282.  
  283. At this point, you can set any breakpoints you wish; when you are ready
  284. to see your program run on the 29K board, use the _GDBN__ command
  285. @code{run}.
  286.  
  287. To stop debugging the remote program, use the _GDBN__ @code{detach}
  288. command.
  289.  
  290. To return control of the PC to its console, use @code{tip} or @code{cu}
  291. once again, after your _GDBN__ session has concluded, to attach to
  292. @code{EBMON}.  You can then type the command @code{q} to shut down
  293. @code{EBMON}, returning control to the DOS command-line interpreter.
  294. Type @code{CTTY con} to return command input to the main DOS console,
  295. and type @kbd{~.} to leave @code{tip} or @code{cu}.
  296.  
  297. @node Remote Log,  , _GDBP__-EB29K, EB29K Remote
  298. @subsubsection Remote Log
  299. @kindex eb.log
  300. @cindex log file for EB29K
  301.  
  302. The @code{target amd-eb} command creates a file @file{eb.log} in the
  303. current working directory, to help debug problems with the connection.
  304. @file{eb.log} records all the output from @code{EBMON}, including echoes
  305. of the commands sent to it.  Running @samp{tail -f} on this file in
  306. another window often helps to understand trouble with @code{EBMON}, or
  307. unexpected events on the PC side of the connection.
  308. _fi__(_AMD29K__)
  309.  
  310. _if__(_VXWORKS__)
  311. _if__(!_GENERIC__)
  312. @node VxWorks Remote,  , EB29K Remote, Starting _GDBN__
  313. _fi__(!_GENERIC__)
  314. _if__(_GENERIC__)
  315. @node VxWorks Remote,  , EB29K Remote, Remote
  316. _fi__(_GENERIC__)
  317. @subsection _GDBN__ and VxWorks
  318. @cindex VxWorks
  319.  
  320. _GDBN__ enables developers to spawn and debug tasks running on networked
  321. VxWorks targets from a Unix host.  Already-running tasks spawned from
  322. the VxWorks shell can also be debugged.  _GDBN__ uses code that runs on
  323. both the UNIX host and on the VxWorks target.  The program
  324. @code{_GDBP__} is installed and executed on the UNIX host.
  325.  
  326. The following information on connecting to VxWorks was current when
  327. this manual was produced; newer releases of VxWorks may use revised
  328. procedures.
  329.  
  330. The remote debugging interface (RDB) routines are installed and executed
  331. on the VxWorks target.  These routines are included in the VxWorks library
  332. @file{rdb.a} and are incorporated into the system image when source-level
  333. debugging is enabled in the VxWorks configuration.
  334.  
  335. @kindex INCLUDE_RDB
  336. If you wish, you can define @code{INCLUDE_RDB} in the VxWorks
  337. configuration file @file{configAll.h} to include the RDB interface
  338. routines and spawn the source debugging task @code{tRdbTask} when
  339. VxWorks is booted.  For more information on configuring and remaking
  340. _if__(_FSF__)
  341. VxWorks, see the manufacturer's manual.
  342. _fi__(_FSF__)
  343. _if__(!_FSF__)
  344. VxWorks, see the @cite{VxWorks Programmer's Guide}.
  345. _fi__(!_FSF__)
  346.  
  347. Once you have included the RDB interface in your VxWorks system image
  348. and set your Unix execution search path to find _GDBN__, you are ready
  349. to run _GDBN__.  From your UNIX host, type:
  350.  
  351. @smallexample
  352. % _GDBP__
  353. @end smallexample
  354.  
  355. _GDBN__ will come up showing the prompt:
  356.  
  357. @smallexample
  358. (_GDBP__)
  359. @end smallexample
  360.  
  361. @menu
  362. * VxWorks connection::          Connecting to VxWorks
  363. * VxWorks download::            VxWorks Download
  364. * VxWorks attach::              Running Tasks
  365. @end menu
  366.  
  367. @node VxWorks connection, VxWorks download, VxWorks Remote, VxWorks Remote
  368. @subsubsection Connecting to VxWorks
  369.  
  370. The _GDBN__ command @code{target} lets you connect to a VxWorks target on the
  371. network.  To connect to a target whose host name is ``@code{tt}'', type:
  372.  
  373. @smallexample
  374. (_GDBP__) target vxworks tt
  375. @end smallexample
  376.  
  377. _GDBN__ will display a message similar to the following:
  378.  
  379. @smallexample
  380. Attaching remote machine across net... Success!
  381. @end smallexample
  382.  
  383. _GDBN__ will then attempt to read the symbol tables of any object modules
  384. loaded into the VxWorks target since it was last booted.  _GDBN__ locates
  385. these files by searching the directories listed in the command search
  386. path (@pxref{Environment, ,Your Program's Environment}); if it fails
  387. to find an object file, it will display a message such as:
  388.  
  389. @smallexample
  390. prog.o: No such file or directory.
  391. @end smallexample
  392.  
  393. This will cause the @code{target} command to abort.  When this happens,
  394. you should add the appropriate directory to the search path, with the
  395. _GDBN__ command @code{path}, and execute the @code{target} command
  396. again.
  397.  
  398. @node VxWorks download, VxWorks attach, VxWorks connection, VxWorks Remote
  399. @subsubsection VxWorks Download
  400.  
  401. @cindex download to VxWorks
  402. If you have connected to the VxWorks target and you want to debug an
  403. object that has not yet been loaded, you can use the _GDBN__ @code{load}
  404. command to download a file from UNIX to VxWorks incrementally.  The
  405. object file given as an argument to the @code{load} command is actually
  406. opened twice: first by the VxWorks target in order to download the code,
  407. then by _GDBN__ in order to read the symbol table.  This can lead to
  408. problems if the current working directories on the two systems differ.
  409. It is simplest to set the working directory on both systems to the
  410. directory in which the object file resides, and then to reference the
  411. file by its name, without any path.  Thus, to load a program
  412. @file{prog.o}, residing in @file{wherever/vw/demo/rdb}, on VxWorks type:
  413.  
  414. @smallexample
  415. -> cd "wherever/vw/demo/rdb"
  416. @end smallexample
  417.  
  418. On _GDBN__ type:
  419.  
  420. @smallexample
  421. (_GDBP__) cd wherever/vw/demo/rdb 
  422. (_GDBP__) load prog.o
  423. @end smallexample
  424.  
  425. _GDBN__ will display a response similar to the following:
  426.  
  427. @smallexample
  428. Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
  429. @end smallexample
  430.  
  431. You can also use the @code{load} command to reload an object module
  432. after editing and recompiling the corresponding source file.  Note that
  433. this will cause _GDBN__ to delete all currently-defined breakpoints,
  434. auto-displays, and convenience variables, and to clear the value
  435. history.  (This is necessary in order to preserve the integrity of
  436. debugger data structures that reference the target system's symbol
  437. table.)
  438.  
  439. @node VxWorks attach,  , VxWorks download, VxWorks Remote
  440. @subsubsection Running Tasks
  441.  
  442. @cindex running VxWorks tasks
  443. You can also attach to an existing task using the @code{attach} command as
  444. follows:
  445.  
  446. @smallexample
  447. (_GDBP__) attach @var{task}
  448. @end smallexample
  449.  
  450. @noindent
  451. where @var{task} is the VxWorks hexadecimal task ID.  The task can be running
  452. or suspended when you attach to it.  If running, it will be suspended at
  453. the time of attachment.
  454. _fi__(_VXWORKS__)
  455. _if__(_H8__)
  456. _if__(!_GENERIC__)
  457. @node Hitachi H8/300 Remote,  , VxWorks Remote, Starting _GDBN__
  458. _fi__(!_GENERIC__)
  459. _if__(_GENERIC__)
  460. @node Hitachi H8/300 Remote,  , VxWorks Remote, Remote
  461. _fi__(_GENERIC__)
  462. @subsection _GDBN__ and the Hitachi H8/300
  463. _GDBN__ needs to know three things to talk to your H8/300: 
  464.  
  465. @enumerate
  466. @item
  467. that you want to use @samp{target hms}, the remote debugging
  468. interface for the H8/300 (this is the default for @code{gdb83}, the
  469. version of GDB configured specifically for the H8/300);
  470.  
  471. @item
  472. what serial device connects your host to your H8/300 (the first serial
  473. device available on your host is the default);
  474.  
  475. @item
  476. what speed to use over the serial device.
  477. @end enumerate
  478.  
  479. @kindex device
  480. @cindex serial device for H8/300
  481. Use the special @code{gdb83} command @samp{device @var{port}} if you need to
  482. explicitly set the serial device.  The default @var{port} is the first
  483. available port on your host; on Unix hosts, this is typically something
  484. like @file{/dev/ttya}, and on DOS hosts @file{com1}.
  485.  
  486. @kindex speed
  487. @cindex serial line speed for H8/300
  488. @code{gdb83} has another special command to set the communications speed
  489. for the H8/300: @samp{speed @var{bps}}.  
  490.  
  491. For example, you might start an H8/300 debugging session at 19200 bps
  492. like this (exploiting the default target and device):
  493.  
  494. @smallexample
  495. $ gdb83
  496. @c FIXME: this falsifies the exact text played out, to permit smallbook
  497. @c FIXME... format to come out better.
  498. GDB is free software and you are welcome to distribute copies
  499.  of it  under certain conditions; type "show copying" to see 
  500.  the conditions.
  501. There is absolutely no warranty for GDB; type "show warranty" for details.
  502. GDB _GDB_VN__, Copyright 1992 Free Software Foundation, Inc.
  503. (gdb83) speed 19200
  504. Remote debugging on an H8/300 HMS via /dev/ttya.
  505. Checking target is in sync
  506. Sending commands to set target to 19200
  507. (gdb83) 
  508. @end smallexample
  509.  
  510. @noindent
  511. To download your program and make it the current _GDBN__ target, use the
  512. @code{load} command:
  513.  
  514. @example
  515. (gdb83) load smain
  516. .text: 8000 .. 9d92  ****
  517. .data: 9d92 .. 9e34  *
  518. (gdb83) 
  519. @end example
  520.  
  521. @noindent
  522. While downloading the program (@samp{smain} in this example), _GDBN__
  523. displays the names of the program's sections, and a @samp{*} for each 2K
  524. of data downloaded.  (If you want to refresh _GDBN__ data on symbols or
  525. on the executable file without downloading, use the _GDBN__ commands
  526. @code{file} or @code{symbol-file}.  These commands, and @code{load}
  527. itself, are described in @ref{Files,,Commands to Specify Files}.)
  528.  
  529. All the standard _GDBN__ facilities are at your disposal for controlling
  530. the program on the H8/300; you can start the program with @code{run},
  531. set breakpoints with @code{break}, display data with @code{print} or
  532. @code{x}, and so on.
  533.  
  534. Remember, however, that @emph{operating system} facilities aren't
  535. available on your H8/300; for example, if your program hangs, you can't
  536. send an interrupt---but you can press the @sc{reset} switch!  _GDBN__
  537. will see the effect of a @sc{reset} on the H8/300 board as a ``normal
  538. exit'' of your program.
  539. _fi__(_H8__)
  540.